<template>
  <div class="app-container calendar-list-container">
    <div class="filter-container">
      <el-input style="width: 200px;" class="filter-item" placeholder="商户编号" v-model="listQuery.merchantId"> </el-input>
      <el-input style="width: 200px;" class="filter-item" placeholder="商品编号" v-model="listQuery.goodsId"> </el-input>
      <el-date-picker v-model="listQuery.date" type="date" placeholder="选择日期">
    </el-date-picker>
      <el-button class="filter-item" type="primary" v-waves icon="search" @click="handleFilter">搜索</el-button>
    </div>
    <el-table :key='tableKey' :data="list" v-loading.body="listLoading" border fit highlight-current-row style="width: 100%">

      <el-table-column align="center" label="商户编号" width="450">
        <template scope="scope">
          <span>{{scope.row.merchantId}}</span>
        </template>
      </el-table-column>
    <el-table-column width="419px" align="center" label="商品编号">
      <template scope="scope">
        <span>{{scope.row.GoodsId}}</span>
      </template>
    </el-table-column>
    <el-table-column width="450px" align="center" label="付费次数">
      <template scope="scope">
        <span>{{scope.row.count}}</span>
      </template>
    </el-table-column>
  </el-table>
  <!-- <div v-show="!listLoading" class="pagination-container">
    <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page.sync="listQuery.page" :page-sizes="[10,20,30, 50]" :page-size="listQuery.limit" layout="total, sizes, prev, pager, next, jumper" :total="total"> </el-pagination>
  </div> -->
  
</div>
</template>

<script>
import { areaCount } from '@/api/biz/qr/order/index'
import { mapGetters } from 'vuex'
import { formatDate } from '@/utils/index'
import waves from '@/directive/waves' // 水波纹指令
export default {
  name: 'element',
  directives: {
    waves
  },
  props: {
  },
  data() {
    return {
      methodOptions: ['GET', 'POST', 'PUT', 'DELETE'],
      typeOptions: ['uri', 'button'],
      list: null,
      total: null,
      listLoading: true,
      listQuery: {
        // page: 1,
        // limit: 20,
        merchantId: '',
        goodsId: '',
        areaCode: '',
        layer: '',
        date: ''
      },

      areaCode: 0,
      layer: '',
      textMap: {
        update: '编辑',
        create: '创建'
      },
      tableKey: 0
    }
  },
  created() {
    this.getList()
  },
  computed: {
    ...mapGetters([
      'elements'
    ])
  },
  methods: {
    getList() {
      this.listLoading = true
      this.listQuery.areaCode = this.areaCode
      this.listQuery.layer = this.layer
      if (this.listQuery.date !== '' && this.listQuery.date !== null) {
        this.listQuery.date = formatDate(this.listQuery.date, 'yyyy-MM-dd')
      }
      areaCount(this.listQuery).then(response => {
        console.log('开始。。。。')
        console.log(response.data)
        console.log('结束。。。')
        this.list = response.data
        this.listLoading = false
      })
    },
    handleFilter() {
      this.getList()
    },
    handleSizeChange(val) {
      this.listQuery.limit = val
      this.getList()
    },
    handleCurrentChange(val) {
      this.listQuery.page = val
      this.getList()
    }
  }
}
</script>
